<template>
    <div>
        <el-row>
            <el-col :span="24"  style="text-align: center">
                <div id="publishChart" :style="{height: '380px'}" style="margin: 0 auto"></div>
            </el-col>
        </el-row>
    </div>
</template>
<script>
export default {
    name:'statistic',
    data(){
        return{
            form:{},
        }
    },
    methods:{
        getFare(){
            console.log(this.form)
            this.$http.get("/api/ticket/getStatistic").then((res)=>{
                console.log(res);
                let seriesData = res.data.data
                //配置echarts
                let chart = this.$echarts.init(document.getElementById('publishChart'))
                chart.setOption({
                    title: {
                        text: '不同航班旅客数据统计',
                        x:'center'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        orient: 'vertical',
                        left: 'left',
                    },
                    toolbox: {},
                    calculable : true,
                    series : [
                        {
                            name:'旅客数量',
                            type:'pie',
                            radius : '55%',
                            center: ['50%', '50%'],
                            data:seriesData
                        }
                    ]
                })
            })
        }
    },
    mounted(){
        this.getFare();
    }
}
</script>